import java.util.HashMap;
import java.util.StringTokenizer;
import java.util.Map.Entry;


class P902_39643 {

	
	
	public static void main(String[] args) {
	
		String line = readLn();
		
		while (line != null) {
			
			StringTokenizer st = new StringTokenizer(line);
			
			int n = Integer.parseInt(st.nextToken());
			
			String word;
			
			if (st.hasMoreTokens())
				word = st.nextToken();
			else word = readLn();
//			
			int max = 0; 
			String pass = null;
			
			HashMap<String, Integer> frequency = new HashMap<String, Integer>();
			for (int k = 0; k < word.length() - n + 1; k++) {
				
				String sub = word.substring(k, k + n);
				
				Integer f = frequency.get(sub);
				
				if (f == null) {
					f = Integer.valueOf(0);
				}
				
				f = f + 1;
				frequency.put(sub, f);
				
				if (max < f) {
					max = f;
					pass = sub;
				}
				
			}
		
			
//	
//			
//			for (Entry<String, Integer> entry : frequency.entrySet()) {
//				if (max < entry.getValue()) {
//					max = entry.getValue();
//					pass = entry.getKey();
//				}
//			}
//			
			System.out.println(pass);
			
			line = readLn();
		}
		
	}
	
	static String readLn() {
        String newLine = System.getProperty("line.separator");
        StringBuffer buffer = new StringBuffer();
        int car = -1;
        try {
            car = System.in.read();
            while ((car > 0) && (car != newLine.charAt(0))) {
                buffer.append((char)car);
                car = System.in.read();
            }
            if (car == newLine.charAt(0))
            System.in.skip(newLine.length() - 1);
        } catch (java.io.IOException e) { return (null);}
        if ((car < 0) && (buffer.length() == 0)) return (null);
        return buffer.toString();
    }
	
}
